package flca.osm.perst.util;

import java.util.ArrayList;
import java.util.List;

import org.garret.perst.Rectangle;

import flca.osm.perst.model.IntersectRootClass;
import flca.osm.perst.model.PNode;

public class IntersectionsHelper {

	public static List<PNode>  getIntersections() 
	{
		List<PNode> r = new ArrayList<PNode>();
		
		for (PNode node : getOutputRoot().spatialIdx) {
			r.add(node);
		}
		
		return r;
	}

	public static List<PNode>  getIntersections(int top, int left, int bottom, int right) 
	{
		Rectangle rect = new Rectangle(top, left, bottom, right);
		List<PNode> r = getOutputRoot().spatialIdx.getList(rect);
		return r;
	}


	private static IntersectRootClass getOutputRoot() {
		return DbHelper.getInstance().getInterSectRoot();
	}
}
